package db;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "Blog", catalog = "yoman07_run")
public class Blog implements java.io.Serializable {

	private int idB;
	private String title = "title";
	private String contents = "content";
	private Date data = new Date();
	
	
	public Blog() {
	}

	public Blog(String title, String contents, Date data) {
		this.title = title;
		this.contents = contents;
		Date date = new Date();

		this.data = date;
	}
	
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idB", unique = true, nullable = false)
	public int getIdB() {
		return idB;
	}
	public void setIdB(int idB) {
		this.idB = idB;
	}
	
	@Column(name = "title", nullable = false, length = 20)
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	
	@Column(name = "contents", nullable = false, length = 65535)
	public String getContents() {
		return contents;
	}
	public void setContents(String contents) {
		this.contents = contents;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "data", nullable = false, length = 19)
	public Date getData() {
		return data;
	}
	public void setData(Date data) {
		this.data = data;
	}
	

}
